package com.ruoyi.location.repository;

import com.ruoyi.location.repository.generator.entity.LocationReportRecord;
import com.ruoyi.location.repository.generator.mapper.LocationReportRecordMapper;
import com.ruoyi.location.domain.quickreport.util.DateUtil;
import com.ruoyi.location.vo.req.LocationReportReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class LocationRepository {

    @Autowired
    private LocationReportRecordMapper locationReportRecordMapper;

    public void reportRecord(LocationReportReq recordReq) {
        LocationReportRecord r = new LocationReportRecord();
        r.setUserId(recordReq.getUserId());
        r.setLatitude(recordReq.getLatitude());
        r.setLongitude(recordReq.getLongitude());
        r.setReportTime(DateUtil.parseDate(recordReq.getReportTime(), DateUtil.FORMAT_YYYY_MM_DD_HH_MM_SS));
        locationReportRecordMapper.insertSelective(r);
    }
}
